package com.wanxi.dangdang.common;

/**
 * @Author: 王康
 * @Date: 2021/8/31 17:15
 * @Statement: 订单状态
 */
public enum OrderStateCode {

    UNPAID(1,"未支付"),
    PAID(2,"已支付"),
    ISSUING(3,"出票中"),
    TICKETS_HAVE_BEEN_ISSUED(4,"已出票"),
    CANCELLED(5,"已取消"),
    REFUNDED(6,"已退款"),
    PENDING_REFUND(7,"待退款"),
    REFUND_FAILED(8,"退款失败"),
    COMPLETED(9,"已完成");

    private Integer code;
    private String msg;

    public Integer getCode() {
        return code;
    }

    public String getMsg() {
        return msg;
    }

    public static String getOrderStateCodeMsg(Integer code){
        OrderStateCode[] orderStateCodes = values();
        for (OrderStateCode orderStateCode : orderStateCodes) {
            if (orderStateCode.getCode().equals(code)){
                return orderStateCode.getMsg();
            }
        }
        return null;
    }

    OrderStateCode(Integer code, String msg) {
        this.code = code;
        this.msg = msg;
    }
}
